package resources;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Request;
import javax.ws.rs.core.UriInfo;

import model.Station;

@Path("/station")
public class AllStationRessource 
{
	@Context
	UriInfo uriInfo;
	@Context
	Request request;
	
	
	// This method is called if TEXT_PLAIN is request
	@GET
	@Produces(MediaType.TEXT_PLAIN)
	public String sayPlainTextHello() {
		return "You must specify a station id!";
	}

	// This method is called if XML is request
	@GET
	@Produces(MediaType.TEXT_XML)
	public String sayXMLHello() {
		return "<?xml version=\"1.0\"?>" + "<info> You must specify a station id!" + "</info>";
	}

	// This method is called if HTML is request
	@GET
	@Produces(MediaType.TEXT_HTML)
	public String sayHtmlHello() {
		return "<html> " + "<title>" + "Hello Jersey" + "</title>"
				+ "<body><h1>" + "You must specify a station id!" + "</body></h1>" + "</html> ";
	}
	
	@Path("{id}")
	public StationInfoRessource getStationInfo(@PathParam("id") String id)
	{
		return new StationInfoRessource(uriInfo, request, id);		
	}
	
	

	
}
